﻿using System;
using System.Text.RegularExpressions;

namespace MikeKappel.Com.CS
{
    /// <summary>
    /// Add an attribute to a Html tag  
    /// </summary>
    public static partial class Helper
    {
        public static string HtmlTagAttributeAdd(String Source, String Tag, String Attribute, String Value)
        {
            return Regex.Replace(Source, string.Format(@"(<{0}\b[^>]*?)", Tag), "$1 " + Attribute + "=\"" + Value + "\"");
        }
    }
}